package com.ly.mpayment.persist.service.yidong;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.ly.mpayment.persist.entity.yidong.Payment;
import com.ly.mpayment.persist.hibernate.Page;
import com.ly.mpayment.persist.service.AbstractService;

@Service
public class PaymentServiceImpl extends AbstractService<Payment, Serializable> implements  IPaymentService {


	@Override
	public Payment findByShopNum(String shopNum) {
		return this.findUnique("select p from Payment p where p.shopNum = ?", shopNum);
	}

	@Override
	public Payment findByPayId(String payId) {
		return this.findUnique("select p from Payment p where p.payId = ?", payId);
	}

	@Override
	public boolean savePayMent(Payment pay) {
		if(pay != null){
			this.saveOrUpdate(pay);
			return true;
		}
		return false;
	}

	@Override
	public boolean updatePayMent(Payment pay) {
		if(pay != null){
			this.updateEntity(pay);
			return true;
		}
		return false;
	}

	@Override
	public Page<Payment> findPagePayMent(int start, int pageSize, Map<String, Object> parameters) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Payment> findAll() {
		return this.find("select p from Payment p ");
	}

}
